package com.belizer.demo.stream;

import java.util.Optional;
import java.util.stream.Stream;

public class Demo2 {
    public static void main(String[] args) {
        //准备数据 1-100
        Stream<Integer> integerStream2 = Stream.iterate(1, a -> a + 1).limit(10000000).parallel();

        long s2 = System.currentTimeMillis();
        Optional<Integer> first = integerStream2.findFirst();
        System.out.println("findFirst消耗时间->" + (System.currentTimeMillis() - s2));
    }
}
